package com.worldcup.service.impl;

import com.worldcup.dao.TravelMatchingMapper;
import com.worldcup.model.TravelMatching;
import com.worldcup.service.TravelMatchingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author duwan.zq
 * @date 2018/05/25
 */
@Service
public class TravelMatchingServiceImpl implements TravelMatchingService{

    private final static Logger logger = LoggerFactory.getLogger(TravelMatchingServiceImpl.class);

    @Autowired
    private TravelMatchingMapper travelMatchingMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void insert(TravelMatching travelMatching) {
        travelMatchingMapper.insert(travelMatching);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(TravelMatching travelMatching) {
        travelMatchingMapper.updateByPrimaryKey(travelMatching);
    }

    @Override
    public TravelMatching getTravelMatching(String openid, String refOpenid) {
        return travelMatchingMapper.selectByOpenidAndRefOpenid(openid, refOpenid);
    }
}
